<template>
    <div class="home">
        <navbar title="失物招领" :show-back="false"></navbar>
        <page :top="46">
            <div class="top">
                <van-swipe class="my-swipe" :autoplay="3000" :show-indicators="false" :loop="false" indicator-color="white">
                    <van-swipe-item><img class="imgone" src="../../static/images/Rotating/1.jpg" alt=""></van-swipe-item>
                    <van-swipe-item><img class="imgone" src="../../static/images/Rotating/2.jpg" alt=""></van-swipe-item>
                    <van-swipe-item><img class="imgone" src="../../static/images/Rotating/3.jpg" alt=""></van-swipe-item>
                    <van-swipe-item><img class="imgone" src="../../static/images/Rotating/news.png" alt=""></van-swipe-item>
                </van-swipe>
            </div>
            <div class="searchcont" @click="entersearch()">
                <van-icon size="25" name="search" />
                <div class="searchtext">搜索更多..</div>
            </div>
            <div class="fabu">
                <div @click="enterPush(item)" class="enterpush" v-for=" item, index  in  action " :key="index">
                    <div class="leftenter">
                        <img v-if="item.id==1" class="imgico" src="../../static/images/icon/release.png" alt="">
                        <img v-else class="imgico" src="../../static/images/icon/search.png" alt="">
                        <div class="textset">+发布</div>
                    </div>
                    <div class="absone">
                        {{ item.text }}
                    </div>
                    
                </div>
            </div>
            <p class="tps">tps:听说点击小飞机和放大镜，会进入神秘世界...</p>

            <div class="lastbottom">
                <div class="titlelast">
                    <van-icon name="volume-o" />
                    <div textone>最新消息</div>
                </div>
                <div class="context" v-for=" item, index  in  a " :key="index">
                    <van-icon name="circle" color="yellow" />
                    <div class="contextlast">{{ item }}</div>
                </div>
            </div>
        </page>

    </div>
</template>

<script>
export default {
    data() {
        return {
            action: [
                { text: '失物招领', id: 1 },
                { text: '寻物启事', id: 2 },
            ],
            a:[]
        }
    },
    created() {
        this.getNoticeList()
        // console.log(2222);
    },
    methods: {
        entersearch() {
            this.$router.push({
               name:"inq"
            })
        },
        enterPush({ id }) {
            this.$router.push({
                name: "Push",
                query: { id }
            })
        },
        async getNoticeList() {
            let res = await this.$http.home.notice();
            console.log(res)
            for (let i in res) {
                this.a.push(res[i].notice_text);
            }      
        },
        Inquire(){
            this.$router.push({
                name:"inq"
            })
        }
    }
}
</script>


<style scoped lang='less'>
@import "~@less/Home";
</style>
